var index = {
	path: [''],
	//iframe宽高重置
	windowResize: function(){
		var $win = $(window);
		var winW = $win.width();
		var winH = $win.height();
		var iframeW = winW - 120;
		var iframeH = winH - 70;
		$('.main').height(iframeH);
		$('.main_right iframe').width(iframeW).height(iframeH);
	},
	//当前路径
	current: function(){
		$('.dao_left li a').click(function(){
			/*var t = $(this).text();
			var a = $(this).attr('href');
			index.path[0] = {href: a,txt: t};
			index.pushPath();*/
			
			$('.dao_left li a').removeClass('moren');
			$(this).addClass('moren');
		});
	},
	pushPath: function(){
		var str = '';
		var arr = index.path;
		for (var i = 0; i < arr.length; i++) {
			if(!arr[i].txt){
				return;
			};
			str += '<a href="'+ arr[i].href +'" target="content">'+ arr[i].txt +'</a><span>></span>';
		}
		$('.biaoti').html(str);
		$('.biaoti span:last-child').remove();
	},
	//监听iframe
	iframeLoad: function(){
		var iframe = $(".main_right iframe").get(0);
		if (iframe.attachEvent) {      
	        iframe.attachEvent("onload", function() {   
	            index.getHref(iframe);
	        });      
	    } else {      
	        iframe.onload = function() {      
	            index.getHref(iframe);
	        };      
	    }
	},
	//获取iframe路径
	getHref: function(iframe){
		var a = iframe.contentWindow.location.href;
		var t = iframe.contentWindow.document.title;
		index.path[0] = {href: a,txt: t};
		index.pushPath();
	}
}


$(function(){
	index.windowResize();
	index.current();
	index.iframeLoad();
	
	$(window).resize(function(){
		index.windowResize();
	})
})
